home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 23 / AMIGAplus Sonderheft 23 (2000)(Falke)(DE)[!].iso / Updates / Hardware / BlizKick / Modules / NoClick.ASM < prev    next >
Assembly Source File  |  1999-11-06  |  3KB  |  130 lines

  1. ; FILE: Source:modules/NoClick.ASM          REV: 5 --- NoClick patch
  2.  
  3. ;
  4. ; Drive NoClick -Module
  5. ; ~~~~~~~~~~~~~~~~~~~~~
  6. ; This patch module will turn off drive clicking at very early time...
  7. ; Actually my floppy drive manages to click only once upon reset... :)
  8. ;
  9. ; 1.0: Initial release
  10. ; 1.1: Added support for hackdisk.device. You must specify NoClick
  11. ;      module *AFTER* hackdisk module if you want it function!
  12. ;
  13. ; Written by Harry Sintonen.
  14. ; This source code is Public Domain.
  15. ;
  16.  
  17.     incdir    "include:"
  18.     include    "blizkickmodule.i"    ; Some required...
  19.  
  20.  
  21.     SECTION    PATCH,CODE
  22. _DUMMY_LABEL
  23.     BK_PTC
  24.  
  25. ; Code is run with following incoming parameters:
  26. ;
  27. ; a0=ptr to ROM start (buffer)    eg. $1DE087B8
  28. ; a1=ptr to ROM start (ROM)    eg. $00F80000 (do *not* access!)
  29. ; d0=ROM lenght in bytes    eg. $00080000
  30. ; a2=ptr to _FindResident routine (will search ROM buffer for resident tag):
  31. ;    CALL: jsr (a2)
  32. ;      IN: a0=ptr to ROM, d0=rom len, a1=ptr to resident name
  33. ;     OUT: d0=ptr to resident (buf) or NULL
  34. ; a3=ptr to _InstallModule routine (can be used to plant a "module"):
  35. ;    CALL: jsr (a3)
  36. ;      IN: a0=ptr to ROM, d0=rom len, a1=ptr to module, d6=dosbase
  37. ;     OUT: d0=success
  38. ; a4=ptr to _Printf routine (will dump some silly things (errormsg?) to stdout ;-)
  39. ;    CALL: jsr (a4)
  40. ;      IN: a0=FmtString, a1=Array (may be 0), d6=dosbase
  41. ;     OUT: -
  42. ; d6=dosbase, a6=execbase
  43. ;
  44. ; Code should return:
  45. ;
  46. ; d0=true if succeeded, false if failed.
  47. ; d1-d7/a0-a6 can be trashed. a7 *must* be preserved! ;-)
  48.  
  49.     moveq    #0,d7
  50.  
  51.     cmp.w    #37,($C,a0)        ; Requires KS V37+
  52.     blo.b    .exit
  53.  
  54.     move.l    a1,-(sp)
  55.     lea    (_tdname,pc),a1        ; _FindResident
  56.     jsr    (a2)
  57.     move.l    (sp)+,a1
  58.     tst.l    d0
  59.     beq.b    .exit
  60.     move.l    d0,a2            ; a2=trackdisk resident
  61.  
  62.     cmp.b    #37,(RT_VERSION,a2)    ; V37+
  63.     blo.b    .exit
  64.     btst    #RTB_COLDSTART,(RT_FLAGS,a2) ; Coldstart
  65.     beq.b    .exit
  66.     move.l    (RT_IDSTRING,a2),d0
  67.     beq.b    .exit
  68.     sub.l    a1,d0
  69.     add.l    a0,d0
  70.     move.l    d0,a5            ; a5=RT_IDSTRING in buffer
  71.     bclr    #0,d0            ; Align word
  72.     cmp.b    #'H',(a5)+        ; Hackdisk.device?
  73.     bne.b    .nhackd
  74.     cmp.b    #'a',(a5)
  75.     beq.b    .ishackd
  76. .nhackd
  77.     move.l    d0,a5            ; a5=ptr in buffer
  78.  
  79.     move.l    #$10000/2,d0        ; Max Num of words to seach
  80. .find    addq.l    #2,a5            ; Magic Begins Here:
  81.     subq.l    #1,d0
  82.     beq.b    .perr
  83.     cmp.l    #$086B0001,(a5)
  84.     bne.b    .find
  85.     move.w    #$08EB,(a5)        ; Change!
  86.     moveq    #1,d7
  87.  
  88. .exit    move.l    d7,d0            ; Valid counter?
  89.     bne.b    .xit
  90.     lea    (_error1,pc),a0        ; a0=fmt
  91.     pea    (_tdname,pc)
  92.     move.l    sp,a1            ; a1=array
  93.     jsr    (a4)            ; Call _Printf
  94.     addq.l    #4,sp
  95. .fail    moveq    #0,d0            ; Return fail
  96. .xit    rts
  97.  
  98. .perr    lea    (_error2,pc),a0
  99.     jsr    (a4)            ; Call _Printf
  100.     bra.b    .fail    
  101.  
  102.  
  103.     ; Handle hackdisk.device
  104. .ishackd
  105.     move.l    d0,a5            ; a5=ptr in buffer
  106.  
  107.     move.l    #8192/2,d0        ; Max Num of words to seach
  108. .hfind    addq.l    #2,a5            ; MoreMagic Begins Here:
  109.     subq.l    #1,d0
  110.     beq.b    .perr
  111.     cmp.l    #$08EC0001,(a5)
  112.     bne.b    .hfind
  113.     cmp.w    #53,(4,a5)        ; TDU_PUBFLAGS
  114.     bne.b    .hfind
  115.  
  116.     move.l    #$197C0003,(a5)        ; Change!
  117.     moveq    #1,d7
  118.     bra.b    .exit
  119.  
  120.  
  121. _tdname    dc.b    'trackdisk.device',0
  122.  
  123. _error1    dc.b    'NoClick: This patch requires %s V37+!',10,0
  124. _error2    dc.b    'NoClick: Couldn''t patch!',10,0
  125.  
  126.  
  127.     SECTION    VERSION,DATA
  128.  
  129.     dc.b    '$VER: NoClick_PATCH 1.1 (25.3.97)',0
  130.